# encoding: utf-8
# !/usr/local/bin/python3

"""
@author: Gao Shuo
@contact: dorothy400@163.com
@software: PyCharm
@file: rename_space.py
@time: 2020/4/22 15:42

由于train.txt格式不允许有空格，把所有文件名中的空格替换掉
input:
    1. 需处理的目录, 逗号分割
output: 
"""

import os.path
import sys

if __name__ == "__main__":
    li_path = sys.argv[1].split(',')
    for path in li_path:
        li_file = os.listdir(path)
        for file in li_file:
            new_file = file.replace(" ",'')
            os.rename(os.path.join(path,file), os.path.join(path,new_file))
